package com.example.epic.controller;

import com.example.epic.common.ResponseData;
import com.example.epic.service.ControlLevelService;
import com.example.epic.utils.RedisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping(value = "/wx")
public class ControlLevelController {
    @Autowired
    ControlLevelService controlLevelService;

    @Autowired
    RedisUtils redisUtils;

    @PutMapping(value = "/level/{levelStatus}")
    public ResponseData updateControlLevel(@PathVariable(value = "levelStatus") Integer levelStatus){
        controlLevelService.updateControlLevel(levelStatus);
        redisUtils.set("controlLevel", levelStatus);
        return ResponseData.success("更改疫情防控等级成功");
    }
}
